Skip to content

Conversation

rubenhoenle
Copy link
Member

@rubenhoenle rubenhoenle commented Oct 2, 2025

Description

relates to STACKITSDK-219

Checklist

  • Issue was linked above
  • No generated code was adjusted manually
  • Changelogs
    • Changelog in the root directory was adjusted
    • Changelog(s) of the service(s) were adjusted
  • VERSION file(s) of the service(s) were adjusted
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@rubenhoenle rubenhoenle requested a review from a team as a code owner October 2, 2025 10:11
@rubenhoenle rubenhoenle marked this pull request as draft October 2, 2025 10:11
@Benjosh95 Benjosh95 marked this pull request as ready for review October 9, 2025 18:38
accessToken = getAccessToken();
} catch (ApiException | InvalidKeySpecException e) {
throw new RuntimeException(e);
throw new IllegalStateException(e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if a IllegalStateException is correct here.

From https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html: "Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation."

I think I also saw this in multiple places, so please also check if the IllegalStateException is appropriate there.

// try-catch required, because ApiException can not be thrown in the implementation
// of Interceptor.intercept(Chain chain)
throw new RuntimeException(e);
throw new IllegalStateException(e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. here

throw new RuntimeException(e);
System.out.println(response.toString());
} catch (ApiException | IOException e) {
throw new IllegalStateException(e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


} catch (ApiException | InterruptedException e) {
throw new RuntimeException(e);
throw new IllegalStateException(e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants